Queueing messages related by affinity set

ABSTRACT

In a messaging and queuing system that supports a cluster of logically associated messaging servers for controlling queues of messages, messages are processed. In response to an application program command to a first messaging server, a queue is opened, the queue having multiple instances on further messaging servers of the cluster. Responding to first messaging server putting messages on the queue, messages are distributed among the multiple instances of the queue on their respective messaging servers so as to balance. For the first message of an affinity set, access information for the particular queue instance to which it is put is obtained and stored. The access information may be used in order to send the further message to the particular queue instance and, if said further message is not part of the affinity set, it is put to an instance of the queue as determined by said predetermined rules.

FOREIGN APPLICATION PRIORITY DATA

This application claims benefit of priority of Foreign PatentApplication No. GB 09162992.3, filed in the United Kingdom on Jun. 17,2009, which is herein incorporated by reference.

BACKGROUND OF THE INVENTION

1. Field of the Invention

The present invention relates to a method and computer program forprocessing affinity sets of related messages in a messaging and queuingsystem.

2. Description of the Related Art

In recent years, the ability of application programs to communicate witheach other or with system provided services in a computer system ornetwork without having to become involved in the complexities ofparticular operating systems or communication protocols has been muchenhanced by the development of Message Oriented Middleware (MOM). Thisis software running on top of a computer operating system which providesa common programming interface by means of which applications cancommunicate with other applications without specific knowledge of thedifferent operating systems and/or protocols which may be used by thoseapplications.

One example of Message Oriented Middleware (MOM) is the IBM WebSphere MQproduct family. The most recent version, WebSphere MQ for z/OS Version7.0 (“IBM”, “WebSphere” and “z/OS” are trademarks of InternationalBusiness Machines Corporation), is described in an Information Center onthe IBM Corporation website.

WebSphere MQ and other MOM products employ message queuing which allowsprograms to send and receive application specific data to each otherwithout having a private, dedicated logical connection establishedbetween them. Instead, the applications communicate using messagescontaining a message descriptor and the application specific data. Themessages are held on queues by a queue manager. The queue manager iseffectively the runtime component of the MOM product and may also bereferred to as a messaging server.

These queues may be accessed directly by applications on the same systemusing the same queue manager or their contents may be transmitted over anetwork or multi node system and placed on respective associated queuesaccessible to a receiving application via its respective local queuemanager. In order to transmit messages to remote applications, theoriginating queue manager must first establish a communication channelto the remote queue manager. Both transmission and accessing of queuedmessages take place asynchronously.

Applications communicate with their associated queue managers via astandard application programming interface (API), known as the MessageQueuing Interface (MQI) in the case of WebSphere MQ. Specific MQIcommands cause the queue manager to store (MQPUT) messages on nameddestination queues, either directly, if local, or by transmitting themto the appropriate queue manager at a node elsewhere in the system andalso to retrieve (MQGET) stored messages from such queues. A queue canbe both a source of messages and a destination for messages.

Before an application program can put or get messages from a queue, itmust first connect to the queue manager hosting the queue by means of anMQCONN call. The queue manager responds by returning a connectionhandle, sometimes referred to as Hconn, which is a unique identifier bywhich the program knows the queue manager. The program can then open thequeue by supplying the connection handle as a parameter of an MQOPENcall, which establishes access to an object such as a queue. The outputfrom the MQOPEN call includes an object handle, Hobj, which is anidentifier by which the program knows the queue (or any other object)and is used as an input parameter for any subsequent MQI calls to thesame queue. When an application has finished putting or getting messagesfrom a queue, it normally closes the queue by means of an MQCLOSE call,specifying the appropriate object handle.

All MQI calls also require the selection of a number of other options orparameters, depending on the precise purpose and context of theoperation to be carried out.

In large or heavily used messaging and queuing systems, problems ofsystem administration, availability and workload balancing have beentackled by the use of clusters. Clusters are networks of queue managersthat are logically associated. Communication between queue managers in acluster is much simpler than between unrelated queue managers.Repository queue managers, to which all queue managers have access, havefull knowledge of all queue managers in the cluster. Cluster queues arejust queues hosted by a cluster queue manager and may be advertised toother queue managers within the cluster to simplify communication.

One aspect of clusters which is important in terms of workload balancingand availability is that more than one queue manager in the cluster canhost an instance of the same queue. Because of this, the workload can bedistributed between these queue managers, thereby increasingavailability. Any one of the queue managers that hosts an instance of aparticular queue can handle messages destined for that queue. This meansthat applications need not explicitly name the queue manager whensending messages. A workload management algorithm determines which queuemanager should handle the message.

However, if, in order to benefit from workload management, a messagingand queuing network is set up to have multiple definitions (instances)of the same queue, it is always necessary to consider whether theapplications using the system may have message affinities, that is, theyexchange related messages which need to be processed on the sameinstance of a queue.

Because, with this type of cluster, a message can be routed to any queuemanager that hosts a copy of the correct queue, the logic ofapplications with message affinities can be affected. Suppose forexample, two applications rely on a series of messages flowing betweenthem in the form of questions and answers. It might be important thatall the questions are sent to the same queue manager and that all theanswers are sent back to the other queue manager. In this situation, itis important that the workload management routine does not send themessages to any queue manager that just happens to host a copy of thecorrect queue. Similarly, some applications might require messages to beprocessed in sequence, for example a file transfer application ordatabase replication application that sends batches of messages thatmust be retrieved in sequence.

In general, therefore, it is desirable to remove message affinities fromapplications as far as possible before starting to use clusters.Removing message affinities improves the performance of applications.For example, if an application that has message affinities sends a batchof messages to a queue manager and the queue manager fails afterreceiving only part of the batch, the sending queue manager must waitfor it to recover before it can send any more messages, therebydegrading performance.

Removing messages affinities also improves the scalability ofapplications. A batch of messages with affinities can lock resources atthe destination queue manager while waiting for subsequent messages.These resources may remain locked for long periods of time, preventingother applications from doing their work.

If message affinities can be removed so that it is not necessary toforce all messages to be written to the same destination, an optionMQOO_BIND_NOT_FIXED is specified on the MQOPEN call. This defersselection of a destination until MQPUT time, that is, on amessage-by-message basis. Selection may then be made as determined bythe cluster workload management algorithm.

However, removing message affinities in a clustered system is not alwayspossible. The main problem to which the current invention relates is thelimitation that message affinities prevent the cluster workloadmanagement routines from making the best choice of queue manager.

In such cases, where it is not appropriate to modify applications toremove message affinities, a number of partial solutions to the problemhave been proposed. One solution is to specify the remote-queue name andthe queue manager name on each MQOPEN call. In this case, all messagesput to the queue using that object handle go to the same queue manager,which might be the local queue manager. This makes the applicationresponsible for choosing queue managers in the cluster, something thatthe cluster software itself should be managing.

A variation on this solution is to allow the queue manager that receivesthe first message in a batch to return its name in response. The queuemanager at the sending end can then extract this queue manager name andspecify it on all subsequent messages. The advantage of this method overthe previous one is that some workload balancing is carried out todeliver the first message.

The disadvantage of this method is that the first queue manager mustwait for a response to its first message before sending subsequentmessages. As with the previous method, if there is more than one routeto the queue manager, the sequence of the messages might not bepreserved.

The currently preferred solution is to force all messages to be put tothe same destination within the cluster, by specifying an optionMQOO_BIND_ON_OPEN on the MQOPEN call. By specifying MQOO_BIND_ON_OPEN,all messages that are sent to this queue are forced to be sent to thesame queue manager and thus to the same instance of the queue.MQOO_BIND_ON_OPEN binds all messages to the same queue manager and alsoto the same route. For example, if there is an IP route and a NetBIOSroute to the same destination, one of these will be selected when thequeue is opened and this selection will be honored for all messages putto the same queue using the object handle obtained.

By specifying MQOO_BIND_ON_OPEN all messages are forced to be routed tothe same destination. Therefore applications with message affinities arenot disrupted. If the destination is not available, the messages remainon the transmission queue until it becomes available again.

All of the above known solutions have the limitation, however, that eachqueue hosting a set of affinity messages must be separately opened withMQOPEN, restricted according to the above suggested solutions and thenclosed with an MQCLOSE call before workload management can be resumedfor other message processing tasks of the application which do not haveaffinities or before different affinity sets can be processed. Openingand closing queues in this way consumes both time and resources.

SUMMARY OF THE INVENTION

Accordingly, the present invention provides a method of processingmessages, including affinity sets of related messages, in a messagingand queuing system of the type capable of supporting a cluster oflogically associated messaging servers for controlling and hostingqueues of messages, including multiple instances of the same queue onrespective messaging servers, the method comprising: in response to anapplication program command to a first messaging server, opening a queuehaving multiple instances on respective messaging servers of thecluster; in response to application program commands to said firstmessaging server to put messages on said queue, distributing messagesamong the multiple instances of the queue on their respective messagingservers so as to balance the workload between the servers according topredetermined rules; where the message being put is the first message ofan affinity set, obtaining and storing access information for theparticular queue instance to which said first message is put; and inresponse to an application program command to said first messagingserver to put a further message to the open queue, if said message ispart of the affinity set, using the access information in order to sendthe further message to the particular queue instance and, if saidfurther message is not part of the affinity set, putting it to aninstance of the queue as determined by said predetermined rules.

Thus by using workload distribution information obtained in the courseof the first put operation of an affinity set of messages, messages ofthe set can be routed to the same queue manager and queue instance andsubsequent unrelated sets or messages can be routed to other queues forworkload management or other reasons without the first selected queuehaving to be closed. This gives greater flexibility and efficiency tothe system in handling a mixture of affinity sets and other messages.

The application is able to pass workload distribution informationbetween messages in an affinity set to ensure that a set of logicallyrelated messages are processed by the same server. This makes it simpleto design conversational applications with message affinities which canstill cope with workload distribution of sets of messages which are notrelated to each other.

Preferably, workload balancing is specified by means of an option in theapplication program open command which causes selection of the queueinstance to be deferred until a command to put messages on the queue isreceived.

The access information may be an object handle for the queue instanceselected by said workload balancing step which was generated as a resultof the opening of said queue instance by said first messaging server. Insuch a case, each further message of an affinity set is put to the samequeue instance as its predecessor by reference back to the accessinformation associated with the predecessor message.

Alternatively, the access information may be derived from a messageattribute of said first message of the affinity set, created when aparticular queue instance is selected for said first message.

According to a further aspect, the invention also comprises a computerprogram for carrying out the above method steps.

According to a yet further aspect, the invention also comprises amessaging and queuing network for processing messages, includingaffinity sets of related messages, comprising a cluster of logicallyassociated messaging servers for controlling and hosting queues ofmessages including multiple instances of the same queue on respectivemessaging servers, the network comprising: means responsive to anapplication program command to a first messaging server to open a queuehaving multiple instances on respective messaging servers of thecluster; means responsive to application program commands to said firstmessaging server to put messages on the queue; means for distributingmessages among the multiple instances of said queue on their respectivemessaging servers so as to balance the workload between the serversaccording to predetermined rules; means for obtaining and storing accessinformation for the particular queue instance to which the first messageof an affinity set is put; and means responsive to an applicationprogram command to said first messaging server to put a further messageto the open queue, effective, if said message is part of the affinityset, to use the access information in order to send the further messageto the particular queue instance and, if said further message is notpart of the affinity set, to put it to an instance of the queue asdetermined by said predetermined rules.

BRIEF DESCRIPTION OF THE DRAWINGS

The novel features believed characteristic of the invention are setforth in the appended claims. The invention itself, however, as well asa preferred mode of use, further objectives and advantages thereof, willbest be understood by reference to the following detailed description ofan illustrative embodiment when read in conjunction with theaccompanying drawings, wherein:

FIG. 1 is a schematic diagram of a queue manager cluster in a messagingand queuing system in which the present invention may be employed;

FIG. 2 represents a mixed string of messages including two affinity setswhich may be processed in the cluster of FIG. 1 according to one exampleof the present invention;

FIG. 3 is a sequence diagram showing how the string of messages of FIG.2 is processed according to this example of the present invention;

FIG. 4 is a flow diagram further illustrating the steps of processingthe string of messages of FIG. 2;

FIG. 5 represents a further mixed string of messages including twoaffinity sets whose messages are intermingled which may processed in thecluster of FIG. 1 according to a second example of the presentinvention;

FIG. 6 is a sequence diagram showing how the string of FIG. 5 isprocessed according to the second example of the present invention; and

FIG. 7 is a flow diagram illustrating the process steps of the secondexample of the invention.

DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENT

FIG. 1 illustrates a typical cluster 10 of queue managers, such as IBM'sWebSphere MQ Version 7, in a messaging and queuing network. Four queuemanagers QM1, QM2, QM3 and QM4 are shown hosting a number of queues Q1,Q2, Q3, Q4 and Q5. Although queues Q1, Q2, Q4 and Q5 are unique, twoinstances, labeled 11 and 12, of Q3 are shown on queue managers QM2 andQM4 respectively. Such a cluster, including the multiple queueinstances, is defined by a systems administrator when the cluster isfirst set up.

If an application on QM2 or QM4 puts a message to Q3, the local instanceof Q3, 11 or 12 respectively, is used. However, when an application onQM1 puts a message on QM3, since it does not have a local instance ofthe queue, it does not necessarily know which instance, 11 or 12, of QM3will process its message.

If the MQOPEN call, opening Q3, specifies the MQOO_BIND_NOT_FIXEDoption, the instance, 11 or 12, which is selected is determined by theworkload management algorithm for the cluster. Subsequent messages putto the queue may thus go to either instance depending on the loading andalgorithm.

If the MQOPEN call specifies the MQOO_BIND_ON_OPEN option, all messagesput by QM1 to Q3 will go to the same instance of Q3 until the queue isclosed by an MQCLOSE call. Which of the two instances is chosen dependson how the first message to the queue was routed.

Thus, in the workload-balancing cluster of FIG. 1, the preferredsituation, where there are multiple instances of a queue such as Q3, isthat messages from QM1 having no affinity with each other aredistributed between queue managers QM2 and QM4 based on workload. Thisis achieved by specifying the MQOO_BIND_NOT_FIXED option when anapplication opens a queue such as Q3.

However, if messages do have an affinity with each other, they must beprocessed together in the same queue manager QM2 or QM4. Conventionally,this is achieved by the application specifying the MQOO_BIND_ON_OPENoption when it opens Q3 and using the object handle returned as outputfrom the MQOPEN call to ensure that all messages subsequently put to thequeue are sent to the same queue instance. However, this entails openingthe queue separately for each affinity set of messages and closing itonce all of the set of messages has been sent. Where there are multipleaffinity sets, this can result in performance degradation.

Two examples of strings of messages, including affinity sets, will nowbe considered, in order to illustrate the operation of the presentinvention. It is assumed that the strings are sent by queue manager QM1to queue Q3 on either QM2 or QM4. The first example is illustrated inFIG. 2 and comprises a first affinity set of messages S1, S2 and S3, twounconnected messages M and N and a further affinity set of messages T1and T2. It is necessary that the set S1-S3 should be sent to the sameinstance of Q3 and that the set T1, T2 should also be sent to the sameinstance of Q3 (though not necessarily the same one as set S1-S3). It isunimportant to which instance of Q3 the separate individual messages Mand N are sent. A possible alternative scenario, which could berepresented by FIG. 2, would be that either of the sets represents aconversation between an application program on QM1 and a target programon either QM2 or QM4. Either way, it is necessary that each completeaffinity sets end up on the same target queue instance.

FIG. 3 is a sequence diagram illustrating one way of processing themessages of FIG. 2 without the need to close and reopen the queue Q3. InFIG. 3, queue managers QM1, QM2 and QM4 are represented by verticalbars. QM2 and QM4 host the target queue Q3, as previously indicated. Anapplication program, hosted on QM1, is also represented by a verticalbar to the left of QM1.

The first step shown in line 30 is for the application program to openQ3 by making an MQOPEN call on QM1, specifying the BIND_NOT_FIXEDoption. No local instance of Q3 exists on QM1 although two instances 11and 12 of the target queue Q3 exist on respective queue managers QM2 andQM4. Consequently, specifying the BIND_NOT_FIXED option to QM1 meansthat an MQPUT call on line 32 to QM1 to put the first message S1 of theaffinity set S to queue Q3 invokes the workload management algorithm,also represented by a vertical bar. This algorithm distributes themessage S1 to QM2, say, and to the instance of Q3 hosted on QM2.

The selection made by the workload algorithm causes QM1 (line 33) toassociate the instance on QM2 with the object handle. This could be doneautomatically but in this example is the result of an additional optionon the MQPUT call: “SAVE_BIND_INFO”. This causes QM1 to remember thedistribution information pointing to the just selected instance of Q3.Since the originating application program knows that the next message S2is part of an affinity set with S1, when it puts S2 to Q3 (line 34) itincludes a special option on the MQPUT call: “BIND_AS_PREVIOUS”. Thisensures that, by referring to the associated distribution information,message S2 is put to the same Q3 instance as S1, namely the one on QM2.Once again, the queue manager remembers the selected instance of Q3(line 35) and associates it (line 35) with the relevant object handle.

After this, message S3 is put to Q3 (line 36) in the same way as S2,namely, using the BIND_AS_PREVIOUS option. Further distributioninformation is no longer needed since the application knows the nextmessage M is not part of the affinity set. The arrowed curved lines inFIG. 2 represent the BIND_AS_PREVIOUS associations between affinity setmessages and their immediately preceding messages of the set.

In fact, neither of the next two messages M and N from QM1 is part of anaffinity set and so may be put to either instance of Q3 by the workloadmanagement algorithm. By way of example, message M is shown on line 37as being put to the instance of Q3 on QM4 whereas message N is shown online 38 as being put to the instance of Q3 on QM2.

Next, the further affinity set T is processed and message T1 is put(line 39) to whichever queue manager hosting Q3 is selected by theworkload management algorithm. For the purposes of this example, theselected queue manager is assumed to be QM4. As was the case with set S,the selection information for message T1 is saved (line 40) and used byQM1 to associate the object handle for the Q3 instance on QM4 with theset T. When message T2 is put to Q3, on line 39, BIND_AS_PREVIOUS isagain specified so that it also goes to the Q3 instance on QM4.

Thus, although normal workload management for messages put to Q3 wasinitially selected by specifying the BIND_NOT_FIXED option, it isoverridden for sets S and T to make sure that they arrive on respectivesingle instances of Q3. Assuming the application has finished with Q3for the time being, the two instances of Q3 on QM2 and QM4 may now beeffectively closed (line 42) by QM1 disconnecting from them.

FIG. 4 is a flow diagram further illustrating the process steps of theinvention, as used in the example of FIGS. 2 and 3. In step 49, thetarget queue Q3, which has multiple instances on QM2 and QM4, is opened,specifying BIND_NOT_FIXED. Assuming, there are messages to be processedand this is not the end of the message string, as determined by step 50,the first message is supplied for putting to the target queue in step52.

The application program knows whether this message is part of anaffinity set. If it is not, as indicated by decision box 53, it is putto whichever instance of the target queue is selected by the workloadmanagement algorithm in step 54. If it is part of an affinity set and isthe first message of the set, as indicated in decision box 55, theworkload management algorithm is again used, in box 56, to select thetarget queue instance and send the message to that instance. Thedistribution information is saved in step 59 in response to theSAVE_BIND_INFO having been specified. Control then returns to step 50and awaits the next message, upon receipt of which appropriate ones ofthe above steps will be repeated.

If the next message is also part of the affinity set, other than thelast, as determined in step 58, it is sent to the queue instanceidentified by the saved distribution information, as a result of theBIND_AS_PREVIOUS option being specified on the PUT call. Again, thedistribution information is saved in step 59. When the last message ofthe affinity set is put, as indicated by the negative output fromdecision step 58, it is not necessary to save further distributioninformation and control returns directly to step 50. When the result ofstep 50 is that there are no more messages to send, the queue is closedin step 51.

This invention thus offers the capability to route different affinitysets of messages to queues on different messaging servers without firsthaving to close the queues between the different sets of messages ordisable normal workload management.

The approach of FIGS. 3 and 4 is sufficient for many applications whereeach affinity set is an unbroken string of messages. However, it willnot work in more complex situations where messages of different affinitysets may be interleaved with each other or mingled with ordinarymessages. This is because the BIND_AS_PREVIOUS option causes a messageto be routed to the same destination as the immediately precedingmessage, which, in the more complex example, may not be part of the sameaffinity set.

FIG. 5 shows an exemplary message string of this type. In this string, afirst affinity set consisting of messages U1, U2, and U3 is interleavedwith an unrelated single message W and with a second affinity setconsisting of messages V1 and V2. It can be seen that routing messagesto the queue instance of the preceding message would not result in allmembers of the same affinity set ending up on the same queue instance.

This can be overcome by associating workload distribution informationwith each particular set and using this, rather than the more general,BIND_AS_PREVIOUS option to determine where subsequent members of the setare sent. This distribution information is returned by the queue managerto the application when the message has been put. In WebSphere MQ,either a message descriptor or a message handle can be used to provide amechanism for returning distribution information about a message to theapplication.

FIG. 6 is a sequence diagram illustrating this alternative way ofprocessing messages, using the exemplary string of messages of FIG. 5.Again, the application program, the three queue managers QM1, QM2 andQM4 and the Workload Algorithm are represented by vertical bars.

The first step, in line 60, is for the application program to issue anMQOPEN call to open Q3. No local instance of Q3 exists on QM1 but twoinstances, 11 and 12 of FIG. 1 of Q3 exist on queue managers QM2 andQM4. As with FIG. 3, the MQOPEN call specifies BIND NOT_FIXED. Thiseffectively activates the workload management algorithm for QM1. Then,an MQPUT call is issued to put the first message U1 of an affinity set,U, to queue Q3. The workload management algorithm decides to send thismessage to the instance of Q3 on queue manager QM2. These actions arerepresented by line 62.

QM1 remembers which version of Q3 was chosen (line 63) and returns thischoice in the message handle supplied to the application, as output fromthe MQPUT call. The message handle is associated with and stored for usewith further members of set U.

However, the next message to be put, V1, is from a different affinityset so the previously stored message handle is not used and, instead,the workload algorithm is used to determine the queue instance of Q3 tobe used and chooses that on QM4, as indicated by line 64. The selectionof QM4 (line 65) is remembered by QM1 and returned to the application ina further message handle for future reference in connection with set V.

Next a single message W, which is not a member of either affinity set,is put to the instance of Q3 on QM2, as determined by the workloadmanagement algorithm (line 66). In this case, a message handle may bereturned in the normal course of events but is not needed fordistribution purposes and so is not illustrated.

After this, the remaining members U2 and U3 of affinity set U are put tothe instance of Q3 indicated by the stored message handle for set U, asshown in lines 67 and 68. Finally, on line 69, the final message V2 ofset V, is put to the instance of Q3 on QM4, as indicated by the storedmessage handle for set V. Reference back to the first message handle ofeach affinity set is also represented in FIG. 5 by arrowed lines.

Assuming all necessary messages have been put for the time being, theapplication program on QM1 may then issue an MQCLOSE call on line 61 toclose Q3. The instances of Q3 on queue managers QM2 and QM4 do notnecessarily disappear but are effectively disconnected by QM1.

FIG. 7 is a flow diagram illustrating the process steps of theinvention, as used in the example of FIGS. 5 and 6. The initial stepsare identical to those of FIG. 4. Thus, in step 70, the target queue Q3,which has multiple instances on QM2 and QM4, is opened, specifyingBIND_NOT_FIXED. Assuming, there are messages to be processed and this isnot the end of the message string, as determined by step 71, the firstmessage is supplied for putting to the target queue in step 72.

The application program knows whether this message is part of anaffinity set. If it is not, as indicated by decision box 73, it is putto whichever instance of the target queue is selected by the workloadmanagement algorithm in step 74. If it is part of an affinity set and isthe first message of the set, as indicated in decision box 75, theworkload management algorithm is again used, in box 76, to select thetarget queue instance and send the message to that instance. Controlthen returns to step 71 and awaits the next message, upon receipt ofwhich appropriate ones of the above steps will be repeated.

When the workload distribution information for the first message of aset has been made, in step 76, the selection is incorporated in themessage handle and this is returned to and stored by the application instep 77. In step 78, this information is then used to route subsequentmessages of the affinity set to the same instance of the target queue,after which, control returns to step 71, to await the next message. Whenthe application decides it has no more messages to send, as detected instep 71, it closes the target queue in step 79.

So, to summarize, for the “BIND_AS_PREVIOUS” method of FIGS. 4 and 5, noworkload distribution information need be returned to the application.The queue manager can remember it on behalf of the application and usethis information when it receives the next “BIND_AS_PREVIOUS” request.

The more flexible message handle technique of FIGS. 6 and 7 requires theapplication to be able to refer to a particular set of workloaddistribution information. Using a message handle returned by MQPUT, themessage handle can contain the information which can subsequently beused on the call to put another message in the same affinity set.

1. A method of processing messages, including affinity sets of relatedmessages, for use with a messaging and queuing system of the typecapable of supporting a cluster, the method comprising: in response toan application program command to a messaging server, opening a queuehaving multiple instances of the queue on respective messaging serversof the cluster, wherein the messaging server is among a plurality oflogically associated messaging servers for controlling and hostingqueues of messages, wherein the messaging server and respectivemessaging servers are logically associated; in response to applicationprogram commands to the messaging server to put a plurality of messageson the queue, distributing messages among the multiple instances of thequeue so as to balance a workload between at least two messaging serversaccording to predetermined rules, wherein the at least two messagingservers are among the plurality of logically associated messagingservers; obtaining and storing access information for a particular queueinstance to which a first message of the plurality of messages is put,wherein the first message is a first message of an affinity set; and inresponse to an application program command to the messaging server toput a first further message to the queue, wherein the first furthermessage is part of the affinity set, sending the first further messageto the particular queue instance using the access information.
 2. Themethod as claimed in claim 1, wherein distributing messages among themultiple instances is specified by an option in an application programcommand which causes selection of a queue instance to be deferred untila command to put messages on the queue is received.
 3. The method asclaimed in claim 1, wherein distributing further comprises using anobject handle as the access information for selecting the queueinstance; and responsive to opening the queue, generating the objecthandle, wherein opening is performed by the messaging server.
 4. Themethod as claimed in claim 3 further comprising: referencing an accessinformation associated with a predecessor message of the message; andwherein putting the first further message of the affinity set to thequeue comprises putting the first further message to a queue of thepredecessor message.
 5. The method as claimed in claim 1 furthercomprising: in response to selecting the particular queue instance forthe first message, deriving access information from a message attributeof the first message.
 6. The method as claimed in claim 1 furthercomprising: in response to an application program command to themessaging server to put a second further message to the queue, whereinthe second further message is not part of the affinity set, putting thesecond further message to an instance of the queue as determined by thepredetermined rules.
 7. A messaging and queuing network for processingmessages, including affinity sets of related messages, for use with amessaging and queuing system of the type capable of supporting acluster, the network comprising: a computer system for opening a queuehaving multiple instances of the queue on respective messaging serversof the cluster, wherein the messaging server is among a plurality oflogically associated messaging servers for controlling and hostingqueues of messages, wherein the messaging server and respectivemessaging servers are logically associated; responsive to a commandingto the messaging server by an application program command; a computersystem for distributing messages among the multiple instances of thequeue so as to balance a workload between at least two messaging serversaccording to predetermined rules, wherein the at least two messagingservers are among the plurality of logically associated messagingservers responsive to commanding by an application program command, themessaging server to put a plurality of messages on the queue; a computersystem for obtaining and storing access information for a particularqueue instance to which a first message of the plurality of messages isput, wherein the first message is a first message of an affinity set; acomputer system for sending the first further message to the particularqueue instance using the access information in response to commanding byan application program command to the messaging server to put a firstfurther message to the queue, wherein the first further message is partof the affinity set; and a computer system for putting a second furthermessage to an instance of the queue as determined by the predeterminedrules, in response to commanding by an application program command tothe messaging server to put the second further message to the queue,wherein the second further message is not part of the affinity set. 8.The messaging and queuing network as claimed in claim 7, wherein thecomputer system for distributing messages among the multiple instancesis specified by an option in an application program command which causesselection of a queue instance to be deferred until a command to putmessages on the queue is received.
 9. The messaging and queuing networkas claimed in claim 7, wherein the computer system for distributingfurther comprises a computer system for using an object handle as theaccess information for selecting the queue instance; and, a computersystem for generating the object handle responsive to opening the queue,wherein opening is performed by the messaging server.
 10. The messagingand queuing network as claimed in claim 9 further comprising: a computersystem for referencing an access information associated with apredecessor message of the message; and wherein the computer system forputting the first further message of the affinity set to the queuecomprises a computer system for putting the first further message to aqueue of the predecessor message.
 11. The messaging and queuing networkas claimed in claim 7 further comprising: a computer system for derivingaccess information from a message attribute of the first message inresponse to selecting the particular queue instance for the firstmessage.
 12. The messaging and queuing network of claim 7, wherein thecomputer system for opening opens a queue by supplying a connectionhandle as a parameter of an MQOPEN call, thereby establishing access tothe queue.